<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
    <title>Title</title>
    <style>
        h1 {
            margin: 0;
        }

        .show-box {
            font-size: 12px;
            font-family: simsun;
            /*white-space: nowrap;*/
            letter-spacing: -1px;
            line-height: .5;
            transform: scale(.6, .9) translate(-33.3%, -6%);
        }
    </style>
</head>
<body>
<h1>SHOW THE TXT</h1>
GETTXT: <span class="get_txt"></span>&nbsp;|&nbsp;&nbsp;TIME: <span class="now_time">0</span> &nbsp;Seconds; &nbsp;|&nbsp;&nbsp;PAGE:
<span class="txt_num">0</span> .txt
<h2 class="tip">已完成转码的帧数： <span class="get_txt"></span></h2>
<div>
    <video class="my_video" src="./aisha.mp4" preload="auto"></video>
</div>
<pre class="show-box"></pre>
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script>
    $(function () {
        var total = 305;
        var txt_num = 1;
        var show_num = 1;
        var now_time = 1;
        var txt_arr = [];

        function getTxt() {
            $.ajax({
                url: './txt/' + txt_num + '.txt',
                success: function (txt) {
                    txt_arr.push(txt);
                    $(".get_txt").html(txt_num);
                    txt_num++;
                    if (txt_num > total) {
                        txt_num -= 1;
                        $('.tip').fadeOut(function () {
                            $(".my_video").animate({
                                width: "320px"
                            }, 1000, function () {
                                $(".my_video").get(0).play();
                                get_time();
                                setTimeout(function () {
                                    show_txt();
                                }, 50);
                            });

                        });

                        return
                    }
                    getTxt()
                }
            });
        }

        getTxt();

        function show_txt() {
            $(".txt_num").html(show_num);
            $('.show-box').html(txt_arr[show_num]);

            show_num++;
            if (show_num > txt_num) {
                return null;
            } else {
                setTimeout(show_txt, 38 / total * 1000);//
            }
        }

        function get_time() {

            $(".now_time").html(now_time);
            now_time += 1;
            if (now_time > 38) {
                return
            }
            setTimeout(get_time, 1000)
        }


    })
</script>
</body>
</html>